import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 商品规格
 */
@Entity('mall_spec')
export class MallSpecEntity extends BaseEntity {
  @Index()
  @Column({ comment: '商品ID' })
  goodsId: number;

  @Column({ comment: '规格名称', length: 255 })
  name: string;

  @Column({ comment: '规格图片', length: 255, nullable: true })
  pic: string;

  @Column({
    comment: '价格',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  price: number;

  @Column({ comment: '库存量', default: 0 })
  stock: number;

  @Column({ comment: '排序值', default: 0 })
  order: number;
}
